<h2><a name="how-it-works" id="how-it-works">How it Works</a></h2>
<p>A single control process (the parent) is responsible for launching
child processes. Each child process creates a fixed number of server
threads as specified in the <code class="directive"><a href="../mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code> directive, as well
as a listener thread which listens for connections and passes them
to a server thread for processing when they arrive.</p>
<p>Apache always tries to maintain a pool of <dfn>spare</dfn> or
idle server threads, which stand ready to serve incoming
requests. In this way, clients do not need to wait for a new
threads or processes to be created before their requests can be
served. The number of processes that will initially launched is
set by the <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code>
directive. During operation, Apache assesses the total number
of idle threads in all processes, and forks or kills processes to
keep this number within the boundaries specified by <code class="directive"><a href="../mod/mpm_common.html#minsparethreads">MinSpareThreads</a></code> and <code class="directive"><a href="../mod/mpm_common.html#maxsparethreads">MaxSpareThreads</a></code>. Since this
process is very self-regulating, it is rarely necessary to modify
these directives from their default values. The maximum number of
clients that may be served simultaneously (i.e., the maximum total
number of threads in all processes) is determined by the
<p>A typical configuration of the process-thread controls in
the <code class="module"><a href="../mod/worker.html">worker</a></code> MPM could look as follows:</p>
<div class="example"><p><code>
ServerLimit 16<br />
StartServers 2<br />
MaxClients 150<br />
MinSpareThreads 25<br />
MaxSpareThreads 75<br />
ThreadsPerChild 25
</code></p></div>
<p>While the parent process is usually started as <code>root</code>
under Unix in order to bind to port 80, the child processes and threads
are launched by Apache as a less-privileged user. The <code class="directive"><a href="../mod/mpm_common.html#user">User</a></code> and <code class="directive"><a href="../mod/mpm_common.html#group">Group</a></code> directives are used to set
the privileges of the Apache child processes. The child processes
must be able to read all the content that will be served, but
should have as few privileges beyond that as possible. In
addition, unless <code class="program"><a href="../programs/suexec.html">suexec</a></code> is used,
these directives also set the privileges which will be inherited
controls how frequently the server recycles processes by killing
old ones and launching new ones.</p>
</div>
</div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../de/mod/worker.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
<a href="../en/mod/worker.html" title="English"> en </a> |
<a href="../ja/mod/worker.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
</div><div id="footer">
<p class="apache">Copyright 1995-2006 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>